<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="/tld/dictionary" prefix="dictionary"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style1.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style2.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/invalid.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/jquery.ui.all.css">
<script src="${ctx}/static/script/jquery-1.4.min.js"></script>
<script src="${ctx}/static/script/jquery.ui.core.js"></script>
<script src="${ctx}/static/script/jquery.ui.widget.js"></script>
<script type="text/javascript" src="${ctx}/static/My97DatePicker/WdatePicker.js"></script>
<script src="${ctx}/static/script/jsCoreUtil.js"></script>
<title> 投资管理</title>
</head>
<body>
<form:form id="mainForm" action="${ctx}/fortune/invest_add" modelAttribute="fortuneInfoForm" method="post">
<input type="hidden" id="customerInfo.id" name="customerInfo.id" value="${fortuneInfoForm.customerInfo.id}"  />
<input type="hidden" id="createDate" name="createDate" value="<fmt:formatDate value="${fortuneInfoForm.createDate}" type="date"/>" />
<input type="hidden" id="createUserId" name="createUserId" value="${fortuneInfoForm.createUserId}" />
<input type="hidden" id="id" name="id" value="${fortuneInfoForm.id}" />
<input type="hidden" id="accId" name="accId" value="${fortuneInfoForm.accId}" />

<input type="hidden" id="customerInfo.customerCode" disabled name="customerInfo.customerCode" value="${fortuneInfoForm.customerInfo.customerCode}" class="ggkj_inputtext_80" />
<input type="hidden" id="customerInfo.cnName" name="customerInfo.cnName" value="${fortuneInfoForm.customerInfo.cnName}" class="ggkj_inputtext_80"  />
<input type="hidden" id="customerInfo.cardType" name="customerInfo.cardType" value="${fortuneInfoForm.customerInfo.cardType}" />
<input type="hidden" id="customerInfo.cardId" name="customerInfo.cardId" value="${fortuneInfoForm.customerInfo.cardId}" class="ggkj_inputtext_180" />
<input type="hidden" id="customerInfo.adress" name="customerInfo.adress" value="${fortuneInfoForm.customerInfo.adress}" class="ggkj_inputtext_80" />

<input type="hidden" id="payBankInfo.id" name="payBankInfo.id"  value="${fortuneInfoForm.payBankInfo.id}" class="ggkj_inputtext_80" readonly="true"/>
<input type="hidden" id="recBankInfo.id" name="recBankInfo.id" value="${fortuneInfoForm.recBankInfo.id}" class="ggkj_inputtext_80" readonly="true"/>

<input type="hidden" id="SysCurrentDate" name="SysCurrentDate" value="${fortuneInfoForm.sysCurrentDate}"/>
<div class="er_banner">投资登记</div>
   <div class="shenqing2">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" id="dd">
		<tr><th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;基本信息：</th></tr>		
		<tr height="1px"><th height="1" colspan="6"style="border-top:#999999 solid 1px;">&nbsp;</th></tr>
		  <c:if test="${fortuneInfoForm.error!=null && fortuneInfoForm.error!=''}">
			<div class="notification error png_bg">
				<a href="#" class="close"><img src="${ctx}/static/images/icons/cross_grey_small.png" title="Close this notification" alt="close" /></a>
				<div>
					${fortuneInfoForm.error}
				</div>
			</div>
		</c:if>
          <tr height="20px">
            <td class="tdright">*客户编号</td>
            <td style="color:#2E74D1;" >
            	<input type="text" id="customerNo" disabled name="customerNo" value="${fortuneInfoForm.customerInfo.customerCode}" class="ggkj_inputtext_180" disabled="true" />
            </td>
            <td class="tdright">*客户姓名</td>
            <td style="color:#2E74D1;">
            	<input type="text" id="" name="" value="${fortuneInfoForm.customerInfo.cnName}" class="ggkj_inputtext_80"  disabled="true"/>
            </td>
			<td class="tdright">*证件类型</td>
            <td style="color:#2E74D1;" >
            <!-- 
            <form:select path="" disabled="true">
            	<dictionary:options type="0010" selectedValue="${fortuneInfoForm.customerInfo.cardType}"/>
            </form:select>
             -->
            <form:select class="u83"  path="customerInfo.cardType" disabled="true">
				<form:option  value="01">身份证</form:option>
				<form:option  value="02">护照</form:option>
				<form:option  value="03">港澳台通行证</form:option>
				<form:option  value="04">港澳台通行证</form:option>
				<form:option  value="99">其他</form:option>
			</form:select>
            </td>
          </tr>
		    <tr>
            <td class="tdright">*证件号码</td>
            <td style="color:#2E74D1;">
            	<input type="text" id="" name="" value="${fortuneInfoForm.customerInfo.cardId}" class="ggkj_inputtext_180" disabled="true"/>
            </td>
            <td class="tdright">*通讯地址</td>
            <td style="color:#2E74D1;" colspan="3">
            <input type="text" id="" name="" value="${fortuneInfoForm.customerInfo.adress}" class="ggkj_inputtext_380" disabled="true"/></td>
          </tr>
          <tr>
            <td class="tdright">*债权还款日</td>
            <td style="color:#2E74D1;">
            <form:radiobutton path="loanReturnDate" value="00120001" checked="checked" /><dictionary:display code="00120001"/>
            <form:radiobutton path="loanReturnDate" value="00120002" /><dictionary:display code="00120002"/>
            <form:errors path="loanReturnDate" cssClass="bind-error"/>
            </td>
			<td class="tdright">*投资方式</td>
            <td style="color:#2E74D1;">
            <form:radiobutton path="regularType" value="00130001"  checked="checked" onclick="regularTypeExec(1)"/><dictionary:display code="00130001"/>
            <form:radiobutton path="regularType" value="00130002" onclick="regularTypeExec(2)"/><dictionary:display code="00130002"/>
            <form:errors path="regularType" cssClass="bind-error"/>
            
            </td>
			<td class="tdright"  >*理财产品</td>
            <td style="color:#2E74D1;">
	            <select id="productType"  name="productType">
	            	<dictionary:options type="0014" selectedValue="${fortuneInfoForm.productType}"/>
				</select>
            </td>
          </tr>
		  <tr height="20px" id="tr2" style="display:'';">
            <td class="tdright">*计划投资金额</td>
            <td style="color:#2E74D1;">
            <input type="text" id="investAmt" name="investAmt"   value="<fmt:parseNumber value="${fortuneInfoForm.investAmt}" />" class="ggkj_inputtext_80" value="" /><form:errors path="investAmt" cssClass="bind-error"/>
            <div style="display:none;" id="div_investAmt"><font color="red">不能为空</font></div>
            </td>
			<td class="tdright">*计划投资日期</td>
            <td style="color:#2E74D1;">
            <input type="text" id="investStartDate" name="investStartDate"  value="<fmt:formatDate value="${fortuneInfoForm.investStartDate}" type="date"/>" readonly="true" onClick="WdatePicker()" size="10"/><form:errors path="investStartDate" cssClass="bind-error"/>
            <div style="display:none;" id="div_investStartDate"><font color="red">不能为空</font></div>
            <div style="display:none;" id="div_investStartDate2"><font color="red">计划投资日期不能小于系统当前日!</font></div>
            </td>
			<td class="tdright">*计划撤资日期</td>
            <td style="color:#2E74D1;"><input type="text" id="investEndDate" name="investEndDate" value="<fmt:formatDate value="${fortuneInfoForm.investEndDate}" type="date"/>" readonly="true" onClick="WdatePicker()" size="10"/><form:errors path="investEndDate" cssClass="bind-error"/>
            <div style="display:none;" id="div_investEndDate"><font color="red">不能为空</font></div>
            <div style="display:none;" id="div_investEndDate2"><font color="red">计划撤资日期不能小于计划投资日期!</font></div>
            </td>
            <td class="tdright"> </td>
            <td style="color:#2E74D1;"> 
            </td>
          </tr>
          
	         
	      <tr id="tr1" style="display:none;">
            <td class="tdright">*定投金额</td>
            <td >
            <input type="text" id="regularAmt" name="regularAmt" value="${fortuneInfoForm.regularAmt}" class="ggkj_inputtext_80" value="" />
            <div style="display:none;" id="div_regularAmt"><font color="red">不能为空</font></div>
            
            </td>
            <td class="tdright">*定投生效日期</td>
            <td style="color:#2E74D1;">
            <input type="text" id="regularStartDate" name="regularStartDate" value="<fmt:formatDate value="${fortuneInfoForm.regularStartDate}" type="date"/>" readonly="true" onClick="WdatePicker()" size="10"/>
            <div style="display:none;" id="div_regularStartDate"><font color="red">不能为空</font></div>
            <div style="display:none;" id="div_regularStartDate2"><font color="red">定投生效日期不能小于系统当前日!</font></div>
            </td>
			<td class="tdright">*定投失效日期</td>
            <td style="color:#2E74D1;"><input type="text" id="regularEndDate" name="regularEndDate" value="<fmt:formatDate value="${fortuneInfoForm.regularEndDate}" type="date"/>" readonly="true" onClick="WdatePicker()" size="10"/>
            <div style="display:none;" id="div_regularEndDate"><font color="red">不能为空</font></div>
            <div style="display:none;" id="div_regularEndDate2"><font color="red">定投失效日期不能小于定投生效日期!</font></div>
            </td>
			<td class="tdright"> </td>
            <td style="color:#2E74D1;"> 
            </td>
	       </tr>
		  <tr >
            <td class="tdright">*付款方式</td>
            <td style="color:#2E74D1;">
			 <form:select path="paymentType" onChange="changePaymentType()">
            	<dictionary:options type="0017" selectedValue="${fortuneInfoForm.paymentType}"/>
            </form:select>
			</td>
            <td class="tdright">*协议版本</td>
            <td style="color:#2E74D1;">
            <select id="agreementVer"  name="agreementVer">
				<dictionary:options type="0016" selectedValue="${fortuneInfoForm.agreementVer}"/>
			</select>
            </td>
            <td class="tdright">*是否风险补偿</td>
            <td style="color:#2E74D1;">
			<form:radiobutton path="useRiskReserve" value="00150001" checked="checked"/><dictionary:display code="00150001"/>
            <form:radiobutton path="useRiskReserve" value="00150002" /><dictionary:display code="00150002"/>
            <form:errors path="useRiskReserve" cssClass="bind-error"/>
            </td>
          </tr>
          <tr>
          <td class="tdright" id="td_remittanceBankId">汇入行别</td>
           <td colspan="3">
			 <div id="div_remittanceBankId" style="display:none">
          	  <form:select path="remittanceBankId">
	            <c:forEach items="${sessionScope.intermediaryBankInfos}" var="item" varStatus="stauts">
	            	<option value="${item.id}" <c:if test="${item.id==fortuneInfoForm.remittanceBankId}">selected="selected"</c:if>><dictionary:display code="${item.bankName}"/>${item.subbranch}</option>
	            </c:forEach>
			  </form:select>
            </div>
			</td>
			<td class="tdright">*管理费折扣</td>
            <td style="color:#2E74D1;">
            	<select id="manageFeeDiscount"  name="manageFeeDiscount">
					<option value="0.10" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.10}">selected="selected"</c:if>>10%</option>
					<option value="0.20" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.20}">selected="selected"</c:if>>20%</option>
					<option value="0.30" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.30}">selected="selected"</c:if>>30%</option>
					<option value="0.40" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.40}">selected="selected"</c:if>>40%</option>
					<option value="0.50" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.50}">selected="selected"</c:if>>50%</option>
					<option value="0.60" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.60}">selected="selected"</c:if>>60%</option>
					<option value="0.70" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.70}">selected="selected"</c:if>>70%</option>
					<option value="0.80" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.80}">selected="selected"</c:if>>80%</option>
					<option value="0.90" <c:if test="${fortuneInfoForm.manageFeeDiscount==0.90}">selected="selected"</c:if>>90%</option>
					<option value="1.00" <c:if test="${fortuneInfoForm.manageFeeDiscount==1.00}">selected="selected"</c:if><c:if test="${fortuneInfoForm.manageFeeDiscount==null}">selected="selected"</c:if> >100%</option>
				</select>
            </td>
          </tr>
         <tr height="20px"><th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;协议信息：</th></tr>
         <tr height="1px"><th   height="1" colspan="6" style="border-top:#999999 solid 1px;">&nbsp;</th><th></th></tr>
           <tr>
            <td class="tdright">*合同编号</td>
            <td style="color:#2E74D1;">
            	<c:if test="${fortuneInfoForm.id!=null}"><!-- 修改 -->
            		<input type="hidden" id="protocolNo"  name="protocolNo" value="${fortuneInfoForm.protocolNo}" onblur ="checkConNoSame();" class="ggkj_inputtext_180" maxlength="18" />
            		<input type="text" value="${fortuneInfoForm.protocolNo}"  class="ggkj_inputtext_180" maxlength="18" disabled=true/>
            	</c:if>
            	<c:if test="${fortuneInfoForm.id==null}">
            		<input type="text" id="protocolNo"  name="protocolNo" value="${fortuneInfoForm.protocolNo}" onblur ="checkConNoSame();" class="ggkj_inputtext_180" maxlength="18" />
            	</c:if>
            	<div id='DivConNo' style='display:none;'><font color="red">合同编号已存在!</fon></div>
            	<form:errors path="protocolNo" cssClass="bind-error"/>
            </td>
            <td class="tdright">*出借编号</td>
            <td style="color:#2E74D1;" colspan="3">
            	<input type="text" id="protocolNo2" name="protocolNo2" value="${fortuneInfoForm.customerInfo.customerCode}" disabled=true/>-
            	<c:if test="${fortuneInfoForm.id!=null}"><!-- 修改 -->
            		<input type="hidden" id="lendingNo" name="lendingNo" maxlength="3" value="${fortuneInfoForm.lendingNo}" size="10" />
            		<input type="text" maxlength="3" value="${fortuneInfoForm.lendingNo}" size="10" disabled=true />
            	</c:if>
            	<c:if test="${fortuneInfoForm.id==null}"><!-- 新增 -->
            		<input type="text" id="lendingNo" name="lendingNo" maxlength="3" value="${fortuneInfoForm.lendingNo}"  size="10" readonly="true"/><!-- onblur ="checkLendingNoSame();" -->
            	</c:if>
            	<div id='DivLendingNo' style='display:none;'><font color="red">出借编号已存在!</fon></div>
            	<form:errors path="lendingNo" cssClass="bind-error"/>
            </td>
          </tr>
		<tr height="20px"><th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;银行卡信息：</th></tr>
		<tr height="1px"><th   height="1" colspan="6"style="border-top:#999999 solid 1px;">&nbsp;</th></tr>
          <tr height="20px">
			  <td class="tdright">*回款账户</td>
	            <td style="color:#2E74D1;" colspan="5">
					<select id="revBankAccId_select" name="revBankAccId_select" onclick="javascript:setRevBlankInfo(this.options[this.selectedIndex].value);">
						<c:forEach items="${fortuneInfoForm.customerInfo.bankInfos}" var="item">
							<option value="${item.id}|${item.bankName}|${item.customerInfo.cnName}|${item.accNo}|${item.subbranch}" <c:if test="${item.id==fortuneInfoForm.recBankInfo.id}">selected="selected"</c:if>><dictionary:display code="${item.bankName}"/>${item.subbranch}</option>
				  		</c:forEach>
					</select>
				</td>
            </tr>
            <tr>
	            <td class="tdright">*开户银行</td>
	            <td style="color:#2E74D1;" colspan="5" ><input type="text" id="rev_blank_name" name="rev_blank_name"  value="<dictionary:display code="${fortuneInfoForm.recBankInfo.bankName}"/>${fortuneInfoForm.recBankInfo.subbranch}" class="ggkj_inputtext_380" disabled="true" />
	            </td>
            </tr>
            <tr>
				<td class="tdright">*开户姓名</td>
	            <td style="color:#2E74D1;"><input type="text" id="rev_username_blank" name="rev_username_blank" value="${fortuneInfoForm.recBankInfo.customerInfo.cnName}" class="ggkj_inputtext_80" disabled="true" />
	            </td>
				<td class="tdright">*开户账号</td>
	            <td style="color:#2E74D1;" colspan="3"><input type="text" id="recBankInfo.id2" name="recBankInfo.id2" value="${fortuneInfoForm.recBankInfo.accNo}" class="ggkj_inputtext_180" disabled="true"/><form:errors path="recBankInfo.id" cssClass="bind-error"/>
	            <div style="display:none;" id="div_recBankInfo.id2"><font color="red">不能为空</font></div>
	            </td>
            </tr>
            <tr><td>&nbsp;</td></tr>
		    <tr height="20px" id="tr3">
	            <td class="tdright">*划扣账户</td>
	            <td style="color:#2E74D1;" colspan="5">
	            	<select id="payBankInfo.id_select" name="payBankInfo.id_select" onclick="javascript:setPayBlankInfo(this.options[this.selectedIndex].value);">
						<c:forEach items="${fortuneInfoForm.customerInfo.bankInfos}" var="item">	
							<option value="${item.id}|${item.bankName}|${item.customerInfo.cnName}|${item.accNo}|${item.subbranch}" <c:if test="${item.id==fortuneInfoForm.payBankInfo.id}">selected="selected"</c:if>><dictionary:display code="${item.bankName}"/>${item.subbranch}</option>
				  		</c:forEach>
					</select>
          </tr>
          <tr id="tr31">
                <td class="tdright">*开户银行</td>
	            <td style="color:#2E74D1;" colspan="5"><input type="text" id="pay_blank_name" name="pay_blank_name" value="<dictionary:display code="${fortuneInfoForm.payBankInfo.bankName}"/>${fortuneInfoForm.payBankInfo.subbranch}" class="ggkj_inputtext_380" disabled="true"/>
	            </td>
          </tr>
          <tr id="tr32">
                <td class="tdright">*开户姓名</td>
	            <td style="color:#2E74D1;"><input type="text" id="pay_username_blank" name="pay_username_blank" value="${fortuneInfoForm.payBankInfo.customerInfo.cnName}" class="ggkj_inputtext_80" disabled="true"/>
	            </td>
				<td class="tdright">*开户账号</td>
	            <td style="color:#2E74D1;"><input type="text" id="payBankInfo.id2" name="payBankInfo.id2"  value="${fortuneInfoForm.payBankInfo.accNo}" class="ggkj_inputtext_180" disabled="true"/><form:errors path="payBankInfo.id" cssClass="bind-error"/>
	             <div style="display:none;" id="div_payBankInfo.id2"><font color="red">不能为空</font></div>
	            </td>
          </tr>
          <tr height="20px">
            <td class="tdright"><input type="checkbox" id="payBankInfo.id_checkbox" name="payBankInfo.id_checkbox" onclick="javascript:setPayBankInfoCheckBox();" /></td>
           	<td colspan="5">同回款账户信息</td> 
          </tr>
		<tr height="20px"><th colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;到期处理意向：</th></tr>
		<tr height="1px"><th  height="1" colspan="6"style="border-top:#999999 solid 1px;">&nbsp;</th></tr>
          <tr height="20px">
            <td class="tdright">*期限类产品到期处理方式</td>
            <td colspan="5" style="color:#2E74D1;">
            <select id="handleType"  name="handleType">
				<dictionary:options type="0018" selectedValue="${fortuneInfoForm.handleType}"/>
			</select>
            <form:errors path="handleType" cssClass="bind-error"/>
			</td>
          </tr>
		    
      </table>
    </div>
<c:if test="${fortuneInfoForm.isShow==null}">
<div class="yiban" style="text-align:left;">
  <input name="investSaveButton" id="investSaveButton" type="button" class="tijiao_big" value="&nbsp;&nbsp;确定"  onclick="formsubmit();"/>&nbsp;
	<!-- customer pages come in -->
	<c:if test="${fortuneInfoForm.id==null}">
		<input name="" type="" class="quxiao_big" value="&nbsp;&nbsp;取消" onclick="window.location=('${ctx}/crm/list?p=history');"/>
	</c:if>
	<!-- invest update come in -->
	<c:if test="${fortuneInfoForm.id!=null}">
		<input name="" type="" class="quxiao_big" value="&nbsp;&nbsp;取消" onclick="window.location=('${ctx}/fortune/invest_list?p=history');"/>
	</c:if>
</div>
</c:if>

<script language="JavaScript">

var alls= new Array(); 
var dictionary = new CoreMap()
var htstatus =false;
var cjstatus =false;
function formsubmit(){
	var thisform = document.getElementById('mainForm');
	var radio=document.getElementsByName("regularType");
	var istrue = false;
	if(radio[1].checked==true){
	var regularAmt=document.getElementById("regularAmt");
		if(regularAmt.value!=""){
			if(isNaN(regularAmt.value)){
				alert("定投金额必须为数字！");
				return;
			}else{
				var point=regularAmt.value.indexOf(".");
				if(point!=-1){
					if(regularAmt.value.substring(point+1).length>2){
						alert("定投金额小数点最多为2位！");
						return;
					}
				}
				if(parseFloat(regularAmt.value)>999999999999999.99 ||parseFloat(regularAmt.value)<0){
					alert("定投金额范围为0~999999999999999.99");
					return;
					}
			}
		}
		if(thisform.regularStartDate.value ==null || thisform.regularStartDate.value==''){
			document.getElementById("div_regularStartDate").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_regularStartDate").style.display='none';
		}
		if(thisform.regularEndDate.value ==null || thisform.regularEndDate.value==''){
			document.getElementById("div_regularEndDate").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_regularEndDate").style.display='none';
		}
		if(thisform.regularAmt.value ==null || thisform.regularAmt.value==''){
			document.getElementById("div_regularAmt").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_regularAmt").style.display='none';
		}
		thisform.investAmt.value='';
		thisform.investEndDate.value='';
		thisform.investStartDate.value='';
	}else if(radio[0].checked==true){
	var investAmt=document.getElementById("investAmt");
		if(investAmt.value!=""){
			if(isNaN(investAmt.value)){
				alert("计划投资金额必须为数字！");
				return;
			}else{
				var point=investAmt.value.indexOf(".");
				if(point!=-1){
					if(investAmt.value.substring(point+1).length>2){
						alert("计划投资金额小数点最多为2位！");
						return;
					}
				}
				if(parseFloat(investAmt.value)>999999999999999.99 ||parseFloat(investAmt.value)<0){
					alert("计划投资金额范围为0~999999999999999.99");
					return;
				}
				
			}
		
		}
		if(thisform.investAmt.value ==null || thisform.investAmt.value==''){
			document.getElementById("div_investAmt").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_investAmt").style.display='none';
		}
		if(thisform.investStartDate.value ==null || thisform.investStartDate.value==''){
			document.getElementById("div_investStartDate").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_investStartDate").style.display='none';
		}
		if(thisform.investEndDate.value ==null || thisform.investEndDate.value==''){
			document.getElementById("div_investEndDate").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_investEndDate").style.display='none';
		}
		thisform.regularAmt.value=='';
		thisform.regularEndDate.value=='';
		thisform.regularStartDate.value=='';
	}
	if(document.getElementById('recBankInfo.id2').value ==null || document.getElementById('recBankInfo.id2').value==''){
		document.getElementById("div_recBankInfo.id2").style.display='';
		istrue=true ;
	}else{
		document.getElementById("div_recBankInfo.id2").style.display='none';
	}
	if(document.getElementById('payBankInfo.id2').value ==null || document.getElementById('payBankInfo.id2').value==''){
		document.getElementById("div_payBankInfo.id2").style.display='';
		istrue=true ;
	}else{
		document.getElementById("div_payBankInfo.id2").style.display='none';
	}
	
	if((thisform.investStartDate.value!='') && (thisform.investEndDate.value!='')){
		if(! compareDate(thisform.investStartDate.value,thisform.investEndDate.value) ){
			document.getElementById("div_investEndDate2").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_investEndDate2").style.display='none';
		}
		/*
		if(!compareDate(GetInputValue("SysCurrentDate"),GetInputValue("investStartDate")) ){
			document.getElementById("div_investStartDate2").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_investStartDate2").style.display='none';
		}*/
	}
	if((thisform.regularStartDate.value!='') && (thisform.regularEndDate.value!='')){
		if(! compareDate(thisform.regularStartDate.value,thisform.regularEndDate.value) ){
			document.getElementById("div_regularEndDate2").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_regularEndDate2").style.display='none';
		}
		/*
		if(!compareDate(GetInputValue("SysCurrentDate"),GetInputValue("regularStartDate")) ){
			document.getElementById("div_regularStartDate2").style.display='';
			istrue=true ;
		}else{
			document.getElementById("div_regularStartDate2").style.display='none';
		}*/
	}
	
	
	if(istrue==true || cjstatus == true || htstatus ==true){
			return ;
	}
	
	
	thisform.submit();
}

function regularTypeExec(v){
var productType=document.getElementById("productType");
	if(v==2){
		document.getElementById('tr1').style.display='';
		document.getElementById('tr2').style.display='none';
		var a=productType.options[productType.selectedIndex].value;
				productType.length=0;
				for(i=0;i<alls.length;i++){
					if(alls[i][1]=="00140005"){
						productType.options[productType.length]=new Option(alls[i][0],alls[i][1]);
					}
				}
				for(m=0;m<productType.options.length;m++){
					if(productType.options[m].value==a){
						productType.options[m].selected=true;
					}
				}
	}else if(v==1){
		document.getElementById('tr2').style.display='';
		document.getElementById('tr1').style.display='none';
		var b=productType.options[productType.selectedIndex].value;
					productType.length=0;
					for(j=0;j<alls.length;j++){
						if(alls[j][1]!="00140005"){
							productType.options[productType.length]=new Option(alls[j][0],alls[j][1]);
						}
					}
					for(m=0;m<productType.options.length;m++){
					if(productType.options[m].value==b){
						productType.options[m].selected=true;
					}
				}
	}	
}
function changePaymentType(){
	var paymentType=document.getElementById("paymentType");
	var remittanceBankId=document.getElementById("remittanceBankId");
	if(paymentType.value=="00170001"){
		remittanceBankId.disabled=false;
		document.getElementById('div_remittanceBankId').style.display='';
		document.getElementById('td_remittanceBankId').style.display='';
	}else{
		remittanceBankId.disabled=true;
		document.getElementById('div_remittanceBankId').style.display='none';
		document.getElementById('td_remittanceBankId').style.display='none';
	}
}
function handleTypeExec(v){
	var handleType2 = document.getElementById('handleType2');
	if(v==2){
		handleType2.disabled=false
	}else if(v==1){
		handleType2.disabled=true;
	}
}
function setRevBlankInfo(info){
	var infos = info.split('|');
	document.getElementById ('rev_username_blank').value=infos[2];	
	document.getElementById ('rev_blank_name').value=dictionary.get(infos[1])+infos[4];
	document.getElementById ('recBankInfo.id').value=infos[0];
	document.getElementById ('recBankInfo.id2').value=infos[3];
	
	var is = document.getElementById('payBankInfo.id_checkbox').checked;
	if(is==true){
		setPayBankInfo(is);
	}
}

function setPayBlankInfo(info){
	var infos = info.split('|');
	document.getElementById ('pay_username_blank').value=infos[2];	
	document.getElementById ('pay_blank_name').value=dictionary.get(infos[1])+infos[4];	
	document.getElementById ('payBankInfo.id').value=infos[0];
	document.getElementById ('payBankInfo.id2').value=infos[3];
}

function setPayBankInfoCheckBox(v){
	var is = document.getElementById('payBankInfo.id_checkbox').checked;
	setPayBankInfo(is);
}
function setPayBankInfo(is){
	if(is==true){
		document.getElementById('tr3').style.display='none';
		document.getElementById('tr31').style.display='none';
		document.getElementById('tr32').style.display='none';
		document.getElementById ('pay_username_blank').value=document.getElementById ('rev_username_blank').value;	
		document.getElementById ('pay_blank_name').value=document.getElementById ('rev_blank_name').value;	
		document.getElementById ('payBankInfo.id').value=document.getElementById ('recBankInfo.id').value;
		document.getElementById ('payBankInfo.id2').value=document.getElementById ('recBankInfo.id2').value;
	}else{
		document.getElementById('tr3').style.display='';
		document.getElementById('tr31').style.display='';
		document.getElementById('tr32').style.display='';
		document.getElementById ('pay_username_blank').value='';	
		document.getElementById ('pay_blank_name').value='';		
		document.getElementById ('payBankInfo.id').value='';	
		document.getElementById ('payBankInfo.id2').value='';	
	}
}

$(function() {
	dictionary = dictionaryInit();
	
	var productType=document.getElementById("productType");
	for(k=0;k<productType.options.length;k++){
		alls[k]=new Array(productType.options[k].text,productType.options[k].value);	
				
	}
	var regularType = document.getElementsByName("regularType");
	if(regularType[1].checked==true){
		regularTypeExec(2);
	}else if(regularType[0].checked==true){
		regularTypeExec(1);
	}
	changePaymentType();
	var payAccno=document.getElementById("payBankInfo.id2");
	var recAccno=document.getElementById("recBankInfo.id2");
	if(payAccno.value==recAccno.value){
		document.getElementById("payBankInfo.id_checkbox").checked=true;
		setPayBankInfo(true);
	}
});

function cope_protocolNo(v){
	SetValue('protocolNo2',v.value);
}

function checkConNoSame(){
	var proNo = GetInputValue('protocolNo');
	if(false){
		alert('合同编号必须由18位数字和字母组成!');
		return ;
	}
	
	$.get("${ctx}/fortune/ajax_check_conno_same?ConNo="+GetInputValue('protocolNo')+"&customerNo="+GetInputValue('customerNo'), function(data) {
		//true 已经存在  ;false不存在
		if(data==true){
			document.getElementById('DivConNo').style.display='';
			SettingButtonStyle('investSaveButton',true);
			htstatus = true;
		}else{//隐藏
			document.getElementById('DivConNo').style.display='none';
			SettingButtonStyle('investSaveButton',false);
			htstatus = false;
		}
	});
}

function checkLendingNoSame(){
	var proNo = GetInputValue('lendingNo');
	if(false){
		alert('合同编号必须由3位数字!');
		return ;
	}
	$.get("${ctx}/fortune/ajax_check_lendingno_same?lendingNo="+GetInputValue('lendingNo')+"&customerNo="+GetInputValue('customerNo'), function(data) {
		//true 已经存在  ;false不存在
		if(data==true){
			document.getElementById('DivLendingNo').style.display='';
			SettingButtonStyle('investSaveButton',true);
			cjstatus = true;
		}else{//隐藏
			document.getElementById('DivLendingNo').style.display='none';
			SettingButtonStyle('investSaveButton',false);
			cjstatus = false;
		}
	});
}
</script>
</body>
</form:form>

</html>
